Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual downwards move with big count goes to end of line and new configuration options #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

saulaxel
Copy link
Contributor

The lose of one column issue with 'virtualedit' wasn't related with the
longest line as previously thought, but with the first line (smallest
one) of selection, so changing it fixes now for real (hopefully) the bug
of losing one column after moving.

Using "range" in functions that didn't used visual selection was a
problem when (a:firstline + count) greater than the last line so that
range was deleted and replaced with at the function calls.

The name 'are_same_line' was really referring to a column, so it was
renamed after 'are_same_cols'

Create function to initialize configurations variables to its defaults.

The variable g:move_map_key can also be a dictionary to permit
enabling/disabling of parts of the default mappings using the entries
'vertical' and 'horizontal' and its subentries 'normal' and 'visual'.

The lose of one column issue with 'virtualedit' wasn't related with the
longest line as previously thought, but with the first line (smallest
one) of selection, so changing it fixes now for real (hopefully) the bug
of losing one column after moving.

Using "range" in functions that didn't used visual selection was a
problem when (a:firstline + count) greater than the last line so that
range was deleted and replaced with <C-u> at the function calls.

The name 'are_same_line' was really referring to a column, so it was
renamed after 'are_same_cols'

Create function to initialize configurations variables to its defaults.
The variable g:move_map_key can also be a dictionary to permit
enabling/disabling of parts of the default mappings using the entries
'vertical' and 'horizontal' and its subentries 'normal' and 'visual'.
Copy link
Owner

@matze matze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still lost the first column and since I enabled listchars I see another issue: in visual blocks with multiple lines and different line lengths, trailing spaces are inserted when shifting left and right.

plugin/move.vim Outdated
@@ -79,6 +88,8 @@ function! s:MoveBlockLeft() range
let l:distance = v:count ? v:count : 1
let l:min_col = min([col("'<"), col("'>")])

" Having 'virtualenv' set to 'onemore' fixes problem of one more movement
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone seems to write a lot of Python code as well ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't find a way to avoid inserting trailing spaces after a left/right move. But found that just removing the spaces after those operations is a possible solution. It is not exactly the same as not inserting them, because removing after an operation can also delete existing (possible wanted) spaces but this solution still will do right most times and could be configurable for those who don't want it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants